

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>Cephadm 概念 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
      <li>Cephadm 概念</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephadm/concepts.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul>
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="cephadm">
<h1>Cephadm 概念<a class="headerlink" href="#cephadm" title="Permalink to this headline">¶</a></h1>
<div class="section" id="vs">
<span id="cephadm-fqdn"></span><h2>全资域名 vs 裸主机名<a class="headerlink" href="#vs" title="Permalink to this headline">¶</a></h2>
<p>cephadm has very minimal requirements when it comes to resolving host
names etc. When cephadm initiates an ssh connection to a remote host,
the host name  can be resolved in four different ways:</p>
<ul class="simple">
<li><p>a custom ssh config resolving the name to an IP</p></li>
<li><p>via an externally maintained <code class="docutils literal notranslate"><span class="pre">/etc/hosts</span></code></p></li>
<li><p>via explictly providing an IP address to cephadm: <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">orch</span> <span class="pre">host</span> <span class="pre">add</span> <span class="pre">&lt;hostname&gt;</span> <span class="pre">&lt;IP&gt;</span></code></p></li>
<li><p>automatic name resolution via DNS.</p></li>
</ul>
<p>Ceph itself uses the command <code class="docutils literal notranslate"><span class="pre">hostname</span></code> to determine the name of the
current host.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>cephadm demands that the name of the host given via <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">orch</span> <span class="pre">host</span> <span class="pre">add</span></code>
equals the output of <code class="docutils literal notranslate"><span class="pre">hostname</span></code> on remote hosts.</p>
</div>
<p>Otherwise cephadm can’t be sure, the host names returned by
<code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">*</span> <span class="pre">metadata</span></code> match the hosts known to cephadm. This might result
in a <a class="reference internal" href="../operations/#cephadm-stray-host"><span class="std std-ref">CEPHADM_STRAY_HOST</span></a> warning.</p>
<p>When configuring new hosts, there are two <strong>valid</strong> ways to set the
<code class="docutils literal notranslate"><span class="pre">hostname</span></code> of a host:</p>
<ol class="arabic simple">
<li><p>Using the bare host name. In this case:</p></li>
</ol>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">hostname</span></code> returns the bare host name.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">hostname</span> <span class="pre">-f</span></code> returns the FQDN.</p></li>
</ul>
<ol class="arabic simple" start="2">
<li><p>Using the fully qualified domain name as the host name. In this case:</p></li>
</ol>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">hostname</span></code> returns the FQDN</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">hostname</span> <span class="pre">-s</span></code> return the bare host name</p></li>
</ul>
<p>Note that <code class="docutils literal notranslate"><span class="pre">man</span> <span class="pre">hostname</span></code> recommends <code class="docutils literal notranslate"><span class="pre">hostname</span></code> to return the bare
host name:</p>
<blockquote>
<div><p>The FQDN (Fully Qualified Domain Name) of the system is the
name that the resolver(3) returns for the host name, such as,
ursula.example.com. It is usually the hostname followed by the DNS
domain name (the part after the first dot). You can check the FQDN
using hostname –fqdn or the domain name using dnsdomainname.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">You</span> <span class="n">cannot</span> <span class="n">change</span> <span class="n">the</span> <span class="n">FQDN</span> <span class="k">with</span> <span class="n">hostname</span> <span class="ow">or</span> <span class="n">dnsdomainname</span><span class="o">.</span>

<span class="n">The</span> <span class="n">recommended</span> <span class="n">method</span> <span class="n">of</span> <span class="n">setting</span> <span class="n">the</span> <span class="n">FQDN</span> <span class="ow">is</span> <span class="n">to</span> <span class="n">make</span> <span class="n">the</span> <span class="n">hostname</span>
<span class="n">be</span> <span class="n">an</span> <span class="n">alias</span> <span class="k">for</span> <span class="n">the</span> <span class="n">fully</span> <span class="n">qualified</span> <span class="n">name</span> <span class="n">using</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">hosts</span><span class="p">,</span> <span class="n">DNS</span><span class="p">,</span> <span class="ow">or</span>
<span class="n">NIS</span><span class="o">.</span> <span class="n">For</span> <span class="n">example</span><span class="p">,</span> <span class="k">if</span> <span class="n">the</span> <span class="n">hostname</span> <span class="n">was</span> <span class="s2">&quot;ursula&quot;</span><span class="p">,</span> <span class="n">one</span> <span class="n">might</span> <span class="n">have</span>
<span class="n">a</span> <span class="n">line</span> <span class="ow">in</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">hosts</span> <span class="n">which</span> <span class="n">reads</span>

       <span class="mf">127.0.1.1</span>    <span class="n">ursula</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span> <span class="n">ursula</span>
</pre></div>
</div>
</div></blockquote>
<p>Which means, <code class="docutils literal notranslate"><span class="pre">man</span> <span class="pre">hostname</span></code> recommends <code class="docutils literal notranslate"><span class="pre">hostname</span></code> to return the bare
host name. This in turn means that Ceph will return the bare host names
when executing <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">*</span> <span class="pre">metadata</span></code>. This in turn means cephadm also
requires the bare host name when adding a host to the cluster:
<code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">orch</span> <span class="pre">host</span> <span class="pre">add</span> <span class="pre">&lt;bare-name&gt;</span></code>.</p>
</div>
<div class="section" id="cephadm-scheduler">
<h2>Cephadm Scheduler<a class="headerlink" href="#cephadm-scheduler" title="Permalink to this headline">¶</a></h2>
<p>Cephadm uses a declarative state to define the layout of the cluster. This
state consists of a list of service specificatins containing placement
specifications (See <a class="reference internal" href="../services/#orchestrator-cli-service-spec"><span class="std std-ref">Service Specification</span></a> ).</p>
<p>Cephadm constantly compares list of actually running daemons in the cluster
with the desired service specifications and will either add or remove new
daemons.</p>
<p>First, cephadm will select a list of candidate hosts. It first looks for
explicit host names and will select those. In case there are no explicit hosts
defined, cephadm looks for a label specification. If there is no label defined
in the specification, cephadm will select hosts based on a host pattern. If
there is no pattern defined, cepham will finally select all known hosts as
candidates.</p>
<p>Then, cephadm will consider existing daemons of this servics and will try to
avoid moving any daemons.</p>
<p>Cephadm supports the deployment of a specific amount of services. Let’s
consider a service specification like so:</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">service_type</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">mds</span>
<span class="nt">service_name</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">myfs</span>
<span class="nt">placement</span><span class="p">:</span>
  <span class="nt">count</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">3</span>
  <span class="nt">label</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">myfs</span>
</pre></div>
</div>
<p>This instructs cephadm to deploy three daemons on hosts labeld with
<code class="docutils literal notranslate"><span class="pre">myfs</span></code> across the cluster.</p>
<p>Then, in case there are less than three daemons deployed on the candidate
hosts, cephadm will then then randomly choose hosts for deploying new daemons.</p>
<p>In case there are more than three daemons deployed, cephadm will remove
existing daemons.</p>
<p>Finally, cephadm will remove daemons on hosts that are outside of the list of
candidate hosts.</p>
<p>However, there is a special cases that cephadm needs to consider.</p>
<p>In case the are fewer hosts selected by the placement specification than
demanded by <code class="docutils literal notranslate"><span class="pre">count</span></code>, cephadm will only deploy on selected hosts.</p>
</div>
</div>



           </div>
           
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>